<?php
$manager = new Model_Manager();

?>
<div id="content">
     <div class="checkout_wrapper">
         <?php if (isset($items)) {  ?>
         
         <div class="checkout_header">
             <h1>Review your order</h1>
         </div>
         
         <div class="checkout_fields">
            <span class="field_description">Item</span>
            <span class="field_quantity">Quantity</span>
            <span class="field_color">Color</span>
            <span class="field_size">Size</span>
            
            <span class="field_price">Price</span>
            
            <span class="field_total">Total price</span>
            <div class="clear"></div>
        </div>
         
         <?php 
         $total = 0;
         foreach ($items as $item): ?>
         
         <?php $total = $total + $item['price']*$item['quantity']; ?>
         <div class="checkout_item">
             <div class="checkout_item_name">
                 <?=$item['name']?>
             </div>
             
             <div class="checkout_item_quantity">
                 <?=$item['quantity']?>
             </div>
             
             <div class="checkout_item_color">
                 <?=$item['color']?>
             </div>
             
             <div class="checkout_item_size">
                 <?=$item['size']?>
             </div>
             
             <div class="checkout_item_price">
                 <?=$item['price']?>
             </div>
             
             <div class="checkout_item_total_price">
                 <?=$item['price']*$item['quantity']?>
             </div>
             <div class="checkout_item_delete">
                 <a href="/commerce/deleteItem/<?=$item['section']?>/<?=$item['id']?>/<?=$item['color']?>/<?=$item['size']?>/" class="chechout_item_remove_btn"></a>
             </div>
             <div class="clear"></div>
         </div>
         
         <?php endforeach; ?>
         <div class="checkout_total">
             <span>TOTAL: $<?php echo (isset($_SESSION['identity']['bonus_new_amount']))? $total-$_SESSION['identity']['bonus_new_amount'] : $total ?></span>
             <div class="clear"></div>
         </div>
         <div class="checkout_payment">
             <div class="checkout_payment_left">
                 <h3>Please, select payment method:</h3>
		<form name="payment" method="POST">
			<input type="hidden" name="payment[delivery]" id="customer-delivery" value="0" />
			<input type="radio" value="creditcard" id="creditcard" name="payment[method]" checked="checked" />
				<label for="creditcard">
				 <img src="/images/icons/payment/visa.png" width="50" height="30" alt="" class="middle" />
				 <img src="/images/icons/payment/mastercard.png" width="50" height="30" alt="" class="middle" />
				 <img src="/images/icons/payment/americanexpress.png" width="50" height="30" alt="" class="middle" />
				 <img src="/images/icons/payment/discover.png" width="50" height="30" alt="" class="middle" />
				</label>
			<br /><br />
			<input type="radio" value="paypal" id="paypal" name="payment[method]" />
				<label for="paypal">
				 <img src="/images/icons/payment/paypal.png" width="50" height="30" alt="" class="middle" />
				</label>
			<br /><br />
			<input class="chk_submit_btn" type="submit" value="CONTINUE" />
		</form>
                 <div class="bonus_section">
<!--                     <div class="bonus_amount">-->
<!--                         Bonus amount-->
<!--                         <span>--><?//=(!empty($_SESSION['identity'])) ? $manager->getBonusAmount($_SESSION['identity']['id']) : '0'?><!--</span>-->
<!--                     </div>-->
<!--                     <div class="use_bonus">-->
<!--                         <span>Use bonus:</span>-->
<!--                        <input type="text" name="bonus_quantity" value="--><?php //echo (isset($_SESSION['identity']['bonus_new_amount'])) ?$_SESSION['identity']['bonus_new_amount'] :'' ?><!--"/><img src="/images/galochka1.png"/>-->
<!--                     </div>-->
                     
                     
                 </div>
                 <a href="/shop/">&larr; Back to Shop</a>
             </div>
             <div class="clear"></div>
         </div>
         <?php } else echo "<div class='checkout_empty_header'>
                                <h1>Shopping Cart</h1>
                                <h2>Your shopping cart is empty</h2>
                                <a href='/shop/'>&larr; Back to Shop</a>
                            </div>"?>
    </div>
</div>
 